home *** CD-ROM | disk | FTP | other *** search
/ ...taking it to the Macs! / ...taking it to the Macs!.iso / Extras / ActiveX Mac SDK / ActiveX SDK / Sample Controls / BDiamond / BDAssert.h next >
Encoding:
C/C++ Source or Header  |  1996-12-20  |  691 b   |  23 lines  |  [TEXT/CWIE]

  1. #include <stdio.h>
  2.  
  3. #ifndef DEBUG
  4. #define DEBUG    0
  5. #endif
  6.  
  7. #if DEBUG
  8. static char    dbgMsg[256];
  9.         
  10. #define assert(test)                                                                        \
  11.     if ( !(test) )    {                                                                        \
  12.         sprintf(dbgMsg,"<ASSERT FAILED> %s : line %d '%s'",__FILE__, __LINE__, #test );     \
  13.         c2pstr(dbgMsg);                                                                        \
  14.         DebugStr((ConstStr255Param)dbgMsg); }
  15. #define check_noerr(err)                                                                            \
  16.     if ( err != 0 )    {                                                                                \
  17.         sprintf(dbgMsg,"<UNEXPECTED ERROR> %s : line %d - result = %d",__FILE__, __LINE__, err );     \
  18.         c2pstr(dbgMsg);                                                                                \
  19.         DebugStr((ConstStr255Param)dbgMsg); }
  20. #else    //    !DEBUG
  21.     #define assert(test) void(0)
  22.     #define check_noerr(value) void(0)
  23. #endif    //    DEBUG